<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <input type="text" id="strInput" >
    <input type="button" value="小写变大写"  id="button1">
    <input type="button2" value="大写变小写"  id="button2">

    <script>

        
        
        button1.onclick = function (){
            function deal(e){
                let strInput = document.getElementById("strInput");
                let str = strInput.value;
                if(e.targer == button1){
                    str = str.toUpperCase();//toLovrCase()
                }else{
                    str = str.toUpperCase();//toLovrCase()
                }
                strInput.value= str;

            
        }
            let button1 = document.getElementById("button1");
            button1.onclick = deal;
            let button2 = document.getElementById("button2");
            button2.onclick = deal;
            
        }
       
    </script>

</body>
</html>
